package com.duoec.dw.lineage.service.analyser.statement;

import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.statement.*;
import com.alibaba.druid.sql.dialect.hive.ast.HiveAddJarStatement;
import com.alibaba.druid.sql.dialect.hive.stmt.HiveCreateFunctionStatement;
import com.duoec.dw.lineage.dto.TableLineageDto;
import com.google.common.collect.Sets;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * 忽略的，不处理的statement
 *
 * @author xuwenzhen
 */
@Component
public class IgnoreSqlStatementAnalyser extends BaseStatementAnalyser<SQLStatement> {
    /**
     * 匹配具体的SQLStatement
     *
     * @return 匹配类型
     */
    @Override
    public Set<Class<? extends SQLStatement>> parseSqlStatements() {
        return Sets.newHashSet(
                HiveCreateFunctionStatement.class,
                SQLShowTablesStatement.class,
                SQLDropFunctionStatement.class,
                SQLTruncateStatement.class,
                SQLUseStatement.class,
                SQLDescribeStatement.class,
                SQLShowColumnsStatement.class,
                HiveAddJarStatement.class
        );
    }

    /**
     * 分析
     *
     * @param statement SQLStatement
     * @return 当前操作的血缘关系
     */
    @Override
    public TableLineageDto analyse(SQLStatement statement) {
        return null;
    }
}
